from pillarsapp import _thread_locals


class RequestObjectMiddleware(object):
    """
    Middleware which allows us to get hold of the request object in places
    where Django doesn't give it to us, e.g. in model save methods.  Use
    get_request() from .utls.py to access the request object.
    """

    def process_request(self, request):
        _thread_locals.request = request